/**
 * 会员相关API
 */
import request, {
  Method
} from '@/utils/request'
import md5Libs from "@/libs/function/md5";

/**
 * 会员分享链接
 */
export function getShareurl() {
  return request.ajax({
    url: `/share/url`,
    method: Method.GET,
    needToken: true
  })
}

/**
 * 分享wap注册
 * @param params
 */
export function registerShareWap(params) {
  params.password = md5Libs.md5(params.password)
  return request.ajax({
    url: '/passport/register/share/wap',
    method: Method.POST,
    needToken: true,
    loading: true,
    params
  })

}
/**
 * 银行凭证API
 * @param params
 */
export function paymentBankVoucher(params) {
  return request.ajax({
    url: '/payment/bankVoucher/',
    method: Method.PUT,
    needToken: true,
    loading: true,
    isJson: true,
    data: params
  })
}

/**
 * 获取代金券明细数据
 * @param params
 * @returns {AxiosPromise}
 */
export function getPointsData(params) {
  return request.ajax({
    url: '/members/points',
    method: 'get',
    needToken: true,
    loading: true,
    params
  })
}

/**
 * 实名登记
 * params
 */
export function getMemberIdentity(params) {
  return request.ajax({
    url: `/mall/member/identity`,
    method: 'get',
    needToken: true,
    params
  })
}

/**
 * 人工后台实名审核
 * params
 */
export function putMemberIdentity(params) {
  return request.ajax({
    url: `/mall/member/identity`,
    method: Method.PUT,
    needToken: true,
    loading: true,
    isJson: true,
    params
  })
}

/**
 * 活动API
 * 提交申请
 * @param params
 */
export function putActiveApply(params) {
  return request.ajax({
    url: '/promotions/active/apply',
    method: Method.PUT,
    needToken: true,
    loading: true,
    isJson: true,
    params
  })
}
/**
 * 查询已提交的申请
 */
export function getPromotionsActiveApplies() {
  return request.ajax({
    url: `/promotions/active/applies`,
    method: Method.GET,
    needToken: true
  })
}

/**
 * 活动内容
 */
export function getPromotionsActive() {
  return request.ajax({
    url: `/promotions/active`,
    method: Method.GET,
    needToken: true
  })
}


/**
 * 抽转盘游戏
 */
export function getmemberGamble() {
  return request.ajax({
    url: `/mall/member/gamble`,
    method: Method.GET,
    needToken: true
  })
}


/**
 * 提现列表
 */
export function getWithdrawalApply(params) {
  return request.ajax({
    url: `/mall/member/withdrawalApply/`,
    method: Method.GET,
    needToken: true,
    params,
  })
}

/**
 * 申请红包
 */
export function putWithdrawalApply(params, pwd) {
  return request.ajax({
    url: `/mall/member/withdrawalApply/${pwd}`,
    method: Method.PUT,
    needToken: true,
    loading: true,
    isJson: true,
    data: params
  })
}

/**
 * 银行账户列表
 */
export function getWithdrawalApplyBanks(params) {
  return request.ajax({
    url: `/mall/member/withdrawalApply/banks`,
    method: Method.GET,
    needToken: true,
    params
  })
}

/**
 * 设置默认银行账户
 */
export function putWithdrawalApplyDefaultBank(params) {
  return request.ajax({
    url: `/mall/member/withdrawalApply/defaultBank`,
    method: Method.PUT,
    needToken: true,
    loading: true,
    isJson: true,
    params: params
  })
}

/**
 * 删除银行账户
 */
export function putWithdrawalApplyRemoveBank(params) {
  return request.ajax({
    url: `/mall/member/withdrawalApply/removeBank`,
    method: Method.DELETE,
    needToken: true,
    loading: true,
    isJson: true,
    params: params
  })
}
